//
//  ShoppingViewController.m
//  AffectionBee
//
//  Created by 李通 on 16/8/18.
//  Copyright © 2016年 chivalrous. All rights reserved.
//

#import "ShoppingViewController.h"
#import "DBManager.h"

@interface ShoppingViewController ()


//懒加载字符数组数据
@property (nonatomic,strong)NSArray <ProductModel *> *productIdArray;


@end

@implementation ShoppingViewController


//懒加载数组
-(NSArray <ProductModel *> *)productIdArray
{
    if (_productIdArray == nil)
    {
        _productIdArray = [DBManager SearchDataWithHasBuyNum];
    }
    
    return _productIdArray;
}


- (void)viewDidLoad
{
    [super viewDidLoad];
    
    NSLog(@"已经购买的商品种类数是 = %lu",(unsigned long)self.productIdArray.count);
    
    [self.productIdArray enumerateObjectsUsingBlock:^(ProductModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
       
        NSLog(@"已经购买的商品是%@,购买的数量是%@,商品的价格是%@",obj.name,obj.hasBuyNum,obj.partner_price);
        
    }];
}




- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

//MYMARK：- 重写父类的方法使modal的控制器返回
- (void)didClickBack
{
    
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end
